<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>demo1</title>
    <style>
        html, body, div, span, h1, h2, h3 {
            margin: 0;
            padding: 0;
            border: 0;
        }

        .demo {
            width: 100vw;
            font-size: 5vw;
            margin: 0 auto;
            background-color: #50688B;
            color: #FFF;
        }

        .demo2 {
            width: 80vw;
            font-size: 5vw;
            margin: 0 auto;
            background-color: #ff6a00;
        }

        .demo3 {
            width: 50vw;
            height: 50vh;
            font-size: 1vw;
            margin: 0 auto;
            background-color: #ff006e;
            color: #FFF;
        }
    </style>
</head>
<body>
<div class="demo">
    <h1>宽度100％, 字体5％</h1>
</div>
<div class="demo2">
    <h2>宽度80％, 字体5％</h2>
</div>
<div class="demo3">
    <h3>宽度50％, 高度50％, 字体1％</h3>
</div>
</body>
</html>